package com.xxxx.seckill.rocketmq;


import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 消息生产者
 *
 * @author 刘红申 on 2022/4/6
 * @time 16:10
 */
@Service
@Slf4j
public class MQProducer {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;


    /**
     * 发送消息
     * @param message
     */
    public void sendSeckillMessage(String message) {
        log.info("发送消息成功"+message);
        rocketMQTemplate.convertAndSend("producer_queue_one", message);
    }
}
